57c59c02290e30f07080110e5c690d72dca535ae,src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java,SizeRotatingFileHandler,rotate,#File#,244
Before Change
new File(newBaseFilename + "." + i).renameTo(new File(newBaseFilename + "." + (i + 1)));
}
// Rename the current file
file.renameTo(new File(newBaseFilename + ".1"));
}
}
}
After Change
}
}
private void rotate(final File file) throws IOException {
if (suffix == null) {
// rotate. First, drop the max file (if any), then move each file to the next higher slot.
Files.deleteIfExists(Paths.get(file.getAbsolutePath() + "." + maxBackupIndex));
for (int i = maxBackupIndex - 1; i >= 1; i--) {
final Path src = Paths.get(file.getAbsolutePath() + "." + i);
if (Files.notExists(src)) {
break;
}
final Path target = Paths.get(file.getAbsolutePath() + "." + (i + 1));
Files.move(src, target, StandardCopyOption.REPLACE_EXISTING);
}
Files.move(file.toPath(), Paths.get(file.getAbsolutePath() + ".1"), StandardCopyOption.REPLACE_EXISTING);
} else {
// This is not efficient, but performance risks were noted on the setSuffix() method
final String suffix = new SimpleDateFormat(this.suffix).format(new Date());
// Create the file name
final String newBaseFilename = file.getAbsolutePath() + suffix;
// rotate. First, drop the max file (if any), then move each file to the next higher slot.
Files.deleteIfExists(Paths.get(newBaseFilename + "." + maxBackupIndex));
for (int i = maxBackupIndex - 1; i >= 1; i--) {
final Path src = Paths.get(newBaseFilename + "." + i);
if (Files.notExists(src)) {
break;
}
final Path target = Paths.get(newBaseFilename + "." + (i + 1));
Files.move(src, target, StandardCopyOption.REPLACE_EXISTING);
}
// Rename the current file
Files.move(file.toPath(), Paths.get(newBaseFilename + ".1"), StandardCopyOption.REPLACE_EXISTING);
}
}
}